package com.fsm.system.controller;

import com.fsm.common.log.config.LogData;
import com.fsm.common.log.entity.dto.OperationEnum;
import com.fsm.common.log.entity.dto.SystemTypeEnum;
import com.fsm.common.tools.Result.Result;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.fsm.system.entity.TSystemTenant;
import com.fsm.system.service.TSystemTenantService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import java.io.Serializable;
import java.util.List;

/**
*  租户管理控制层。
*
* @author
* @since
*/
@RestController
@Tag(name = "租户管理")
@RequestMapping("/tSystemTenant")
public class TSystemTenantController {

	@Autowired
	private TSystemTenantService systemUserService;

	/**
    * 添加租户管理
    *
    * @param tSystemTenant
    * @return
    */
	@LogData(value = "添加租户管理",operation = OperationEnum.INSERT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("addTSystemTenant")
    @Operation(summary="添加租户管理",description="添加租户管理")
    public Result addTSystemTenant(@RequestBody TSystemTenant tSystemTenant) throws Exception{
		return systemUserService.addTSystemTenant(tSystemTenant);
	}

	/**
	* 删除租户管理
	*
	* @param tSystemTenant
	* @return
	*/
	@LogData(value = "删除租户管理",operation = OperationEnum.DELETE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("deleteTSystemTenant")
	@Operation(summary="删除租户管理",description="删除租户管理")
	public Result deleteTSystemTenant(@RequestBody TSystemTenant tSystemTenant) throws Exception{
		return systemUserService.deleteTSystemTenant(tSystemTenant);
	}

	/**
	* 更新租户管理
	*
	* @param tSystemTenant
	* @return
	*/
	@LogData(value = "更新租户管理",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("updateTSystemTenant")
	@Operation(summary="更新租户管理",description="更新租户管理")
	public Result updateTSystemTenant(@RequestBody TSystemTenant tSystemTenant) throws Exception{
		return systemUserService.updateTSystemTenant(tSystemTenant);
	}

	/**
	* 分页查询租户管理
	*
	* @param tSystemTenant
	* @return 分页对象
	*/
	@LogData(value = "分页查询租户管理",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("pageTSystemTenant")
	@Operation(summary="分页查询租户管理",description="分页查询租户管理")
	public Result pageTSystemTenant(@RequestBody TSystemTenant tSystemTenant) throws Exception{
		return systemUserService.pageTSystemTenant(tSystemTenant);
	}

	/**
	* 查询租户管理列表
	*
	* @param tSystemTenant
	* @return 分页对象
	*/
	@LogData(value = "查询租户管理列表",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getTSystemTenantList")
	@Operation(summary="查询租户管理列表",description="查询租户管理列表")
	public Result getTSystemTenantList(@RequestBody TSystemTenant tSystemTenant) throws Exception{
		return systemUserService.getTSystemTenantList(tSystemTenant);
	}

	/**
	* 通过ID查询租户管理
	*
	* @param tSystemTenant
	* @return
	*/
	@LogData(value = "通过ID查询租户管理",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getTSystemTenantById")
	@Operation(summary="通过ID查询租户管理",description="通过ID查询租户管理")
	public Result getTSystemTenantById(@RequestBody TSystemTenant tSystemTenant) throws Exception{
		return systemUserService.getTSystemTenantById(tSystemTenant);
	}

}
